package logic.characters
{

    import Constants;
    
    public class CharacterModel
    {
        public var tileX:uint = 3;
        public var tileY:uint = 3;
        public var offsetX:int = 0;
        public var offsetY:int = 0;
        
        public var tick:int = 0;
        
        
        public function onTick():void
        {
            //Abstract function that should be called by the AI with every tick
        }
        
       
        public function move(dx:uint, dy:uint):void
        {
            offsetX=offsetX+dx;
            offsetY=offsetY+dy;
            
            if (offsetX>Constants.TILE_SIZE) 
            {
                tileX++;
                offsetX=0;
            } 
            else if (offsetX<0) 
            {
                tileX--;
                offsetX = Constants.TILE_SIZE;
            } else if (offsetY>Constants.TILE_SIZE) 
            {
                tileY++;
                offsetY=0;
            } 
            else if (offsetY<0) 
            {
                tileY--;
                offsetY=Constants.TILE_SIZE;
            }
        }
    }

}
